package com.controller;



import com.entity.BYyjl;
import com.entity.BZpxs;
import com.entity.HomePage;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.service.BYyjlService;
import com.service.BZpxsService;
import com.service.HomePageService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@Controller
public class IndexController {
    @Autowired
    private BZpxsService bZpxsService;
    @Autowired
    private HomePageService homePageService;
    @Autowired
    private BYyjlService bYyjlService;
    @GetMapping(value = "")
    public  String index(Model model){
        try{
            QueryWrapper wrapper = QueryWrapper.create();
            List<BZpxs> BZpxslist = bZpxsService.getMapper().selectListByQuery(wrapper);
            HomePage HomePage = homePageService.queryChain().one();
            BYyjl BYyjl = bYyjlService.queryChain().one();
            model.addAttribute("homePage",HomePage);
            model.addAttribute("BZpxslist",BZpxslist);
            model.addAttribute("BYyjl",BYyjl);
        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/index";
    }
    @GetMapping(value = "xinshang")
    public  String xinshang(Model model){
        try{
            QueryWrapper wrapper = QueryWrapper.create();
            List<BZpxs> BZpxslist = bZpxsService.getMapper().selectListByQuery(wrapper);
            model.addAttribute("BZpxslist",BZpxslist);
        } catch (Exception e){
            e.printStackTrace();
        }
        return "client/xinshang";
    }
}
